/***********************************************************************************
Copy right:	    Coffee Tech.
Author:         jiaoyue
Date:           2018-12-26
Description:    文件处理封装
***********************************************************************************/

#ifndef FILE_OPT_H
#define FILE_OPT_H

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <unistd.h>
#include <pub_define.h>

BOOL fileopt_exist(const char *pathname);
long fileopt_getsize(const char *path);
size_t fileopt_readall(const char *path, char *ret_buf);
int find_files_by_name_strict(char *basePath, char *file_name, char *buf, int buf_sz);
int find_files_by_name_weak(char *basePath, char *file_name, char *buf, int buf_sz);
int find_dirs_by_name_weak(char *basePath, char *dir_name, char *buf, int buf_sz);
size_t file_opt_read(const char *path, char *buf, size_t buf_sz);
int file_opt_read_by_line(const char *path, char buf[][MAX_PROC_NAME_SZ], size_t buf_sz, size_t line_sz);
size_t file_opt_write(const char *path, char *dat, size_t dat_len);

#endif  //FILE_OPT_H
